package com.jincp.filepicker.loader;

import android.support.v7.app.AppCompatActivity;

import com.jincp.filepicker.Constant;
import com.jincp.filepicker.bean.AudioFile;
import com.jincp.filepicker.bean.ImageFile;
import com.jincp.filepicker.bean.NormalFile;
import com.jincp.filepicker.bean.VideoFile;
import com.jincp.filepicker.loader.FileLoaderCallbacks.FileLoadResultCallback;


/**
 * =========================================================
 * @ProjectName:
 * @ClassName: SimpleDataLoader
 * @Description:
 * @Author: jincp
 * @CreateDate: 2019/3/22 21:23
 * =========================================================
 */
public class SimpleDataLoader {

    public static void getImages(AppCompatActivity activity, FileLoadResultCallback<ImageFile> callback){
        activity.getSupportLoaderManager().initLoader(0, null,
                new FileLoaderCallbacks(activity, callback, Constant.TYPE_IMAGE));
    }

    public static void getVideos(AppCompatActivity activity, FileLoadResultCallback<VideoFile> callback){
        activity.getSupportLoaderManager().initLoader(1, null,
                new FileLoaderCallbacks(activity, callback, Constant.TYPE_VIDEO));
    }

    public static void getAudios(AppCompatActivity activity, FileLoadResultCallback<AudioFile> callback){
        activity.getSupportLoaderManager().initLoader(2, null,
                new FileLoaderCallbacks(activity, callback, Constant.TYPE_AUDIO));
    }

    public static void getFiles(AppCompatActivity activity, FileLoadResultCallback<NormalFile> callback, String[] suffix){
        activity.getSupportLoaderManager().initLoader(3, null,
                new FileLoaderCallbacks(activity, callback, Constant.TYPE_FILE, suffix));
    }
}
